Optimal. Leaf size=89 \[ \sqrt {a-b} \text {ArcTan}\left (\frac {\sqrt {a-b} \cot (x)}{\sqrt {a+b \cot ^2(x)}}\right )-\frac {(a-2 b) \tanh ^{-1}\left (\frac {\sqrt {b} \cot (x)}{\sqrt {a+b \cot ^2(x)}}\right )}{2 \sqrt {b}}-\frac {1}{2} \cot (x) \sqrt {a+b \cot ^2(x)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 89, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 7, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.412, Rules used = {3751, 489, 537,
223, 212, 385, 209} \begin {gather*} \sqrt {a-b} \text {ArcTan}\left (\frac {\sqrt {a-b} \cot (x)}{\sqrt {a+b \cot ^2(x)}}\right )-\frac {1}{2} \cot (x) \sqrt {a+b \cot ^2(x)}-\frac {(a-2 b) \tanh ^{-1}\left (\frac {\sqrt {b} \cot (x)}{\sqrt {a+b \cot ^2(x)}}\right )}{2 \sqrt {b}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 212
Rule 223
Rule 385
Rule 489
Rule 537
Rule 3751
Rubi steps
\begin {align*} \int \cot ^2(x) \sqrt {a+b \cot ^2(x)} \, dx &=-\text {Subst}\left (\int \frac {x^2 \sqrt {a+b x^2}}{1+x^2} \, dx,x,\cot (x)\right )\\ &=-\frac {1}{2} \cot (x) \sqrt {a+b \cot ^2(x)}+\frac {1}{2} \text {Subst}\left (\int \frac {a+(-a+2 b) x^2}{\left (1+x^2\right ) \sqrt {a+b x^2}} \, dx,x,\cot (x)\right )\\ &=-\frac {1}{2} \cot (x) \sqrt {a+b \cot ^2(x)}+(a-b) \text {Subst}\left (\int \frac {1}{\left (1+x^2\right ) \sqrt {a+b x^2}} \, dx,x,\cot (x)\right )+\frac {1}{2} (-a+2 b) \text {Subst}\left (\int \frac {1}{\sqrt {a+b x^2}} \, dx,x,\cot (x)\right )\\ &=-\frac {1}{2} \cot (x) \sqrt {a+b \cot ^2(x)}+(a-b) \text {Subst}\left (\int \frac {1}{1-(-a+b) x^2} \, dx,x,\frac {\cot (x)}{\sqrt {a+b \cot ^2(x)}}\right )+\frac {1}{2} (-a+2 b) \text {Subst}\left (\int \frac {1}{1-b x^2} \, dx,x,\frac {\cot (x)}{\sqrt {a+b \cot ^2(x)}}\right )\\ &=\sqrt {a-b} \tan ^{-1}\left (\frac {\sqrt {a-b} \cot (x)}{\sqrt {a+b \cot ^2(x)}}\right )-\frac {(a-2 b) \tanh ^{-1}\left (\frac {\sqrt {b} \cot (x)}{\sqrt {a+b \cot ^2(x)}}\right )}{2 \sqrt {b}}-\frac {1}{2} \cot (x) \sqrt {a+b \cot ^2(x)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(2105\) vs. \(2(89)=178\).
time = 22.86, size = 2105, normalized size = 23.65 \begin {gather*} \text {Result too large to show} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(176\) vs.
\(2(71)=142\).
time = 0.15, size = 177, normalized size = 1.99
method | result | size |
derivativedivides | \(-\frac {\cot \left (x \right ) \sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}}{2}-\frac {a \ln \left (\sqrt {b}\, \cot \left (x \right )+\sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}\right )}{2 \sqrt {b}}+b \left (\frac {\ln \left (\sqrt {b}\, \cot \left (x \right )+\sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}\right )}{\sqrt {b}}-\frac {\sqrt {b^{4} \left (a -b \right )}\, \arctan \left (\frac {b^{2} \left (a -b \right ) \cot \left (x \right )}{\sqrt {b^{4} \left (a -b \right )}\, \sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}}\right )}{b^{2} \left (a -b \right )}\right )+\frac {a \sqrt {b^{4} \left (a -b \right )}\, \arctan \left (\frac {b^{2} \left (a -b \right ) \cot \left (x \right )}{\sqrt {b^{4} \left (a -b \right )}\, \sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}}\right )}{b^{2} \left (a -b \right )}\) | \(177\) |
default | \(-\frac {\cot \left (x \right ) \sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}}{2}-\frac {a \ln \left (\sqrt {b}\, \cot \left (x \right )+\sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}\right )}{2 \sqrt {b}}+b \left (\frac {\ln \left (\sqrt {b}\, \cot \left (x \right )+\sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}\right )}{\sqrt {b}}-\frac {\sqrt {b^{4} \left (a -b \right )}\, \arctan \left (\frac {b^{2} \left (a -b \right ) \cot \left (x \right )}{\sqrt {b^{4} \left (a -b \right )}\, \sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}}\right )}{b^{2} \left (a -b \right )}\right )+\frac {a \sqrt {b^{4} \left (a -b \right )}\, \arctan \left (\frac {b^{2} \left (a -b \right ) \cot \left (x \right )}{\sqrt {b^{4} \left (a -b \right )}\, \sqrt {a +b \left (\cot ^{2}\left (x \right )\right )}}\right )}{b^{2} \left (a -b \right )}\) | \(177\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 187 vs.
\(2 (71) = 142\).
time = 2.49, size = 768, normalized size = 8.63 \begin {gather*} \left [\frac {2 \, \sqrt {-a + b} b \log \left (-{\left (a - b\right )} \cos \left (2 \, x\right ) - \sqrt {-a + b} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right ) + b\right ) \sin \left (2 \, x\right ) - {\left (a - 2 \, b\right )} \sqrt {b} \log \left (\frac {{\left (a - 2 \, b\right )} \cos \left (2 \, x\right ) - 2 \, \sqrt {b} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right ) - a - 2 \, b}{\cos \left (2 \, x\right ) - 1}\right ) \sin \left (2 \, x\right ) - 2 \, {\left (b \cos \left (2 \, x\right ) + b\right )} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}}}{4 \, b \sin \left (2 \, x\right )}, \frac {4 \, \sqrt {a - b} b \arctan \left (-\frac {\sqrt {a - b} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right )}{{\left (a - b\right )} \cos \left (2 \, x\right ) + a - b}\right ) \sin \left (2 \, x\right ) - {\left (a - 2 \, b\right )} \sqrt {b} \log \left (\frac {{\left (a - 2 \, b\right )} \cos \left (2 \, x\right ) - 2 \, \sqrt {b} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right ) - a - 2 \, b}{\cos \left (2 \, x\right ) - 1}\right ) \sin \left (2 \, x\right ) - 2 \, {\left (b \cos \left (2 \, x\right ) + b\right )} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}}}{4 \, b \sin \left (2 \, x\right )}, \frac {{\left (a - 2 \, b\right )} \sqrt {-b} \arctan \left (\frac {\sqrt {-b} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right )}{b \cos \left (2 \, x\right ) + b}\right ) \sin \left (2 \, x\right ) + \sqrt {-a + b} b \log \left (-{\left (a - b\right )} \cos \left (2 \, x\right ) - \sqrt {-a + b} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right ) + b\right ) \sin \left (2 \, x\right ) - {\left (b \cos \left (2 \, x\right ) + b\right )} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}}}{2 \, b \sin \left (2 \, x\right )}, \frac {2 \, \sqrt {a - b} b \arctan \left (-\frac {\sqrt {a - b} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right )}{{\left (a - b\right )} \cos \left (2 \, x\right ) + a - b}\right ) \sin \left (2 \, x\right ) + {\left (a - 2 \, b\right )} \sqrt {-b} \arctan \left (\frac {\sqrt {-b} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right )}{b \cos \left (2 \, x\right ) + b}\right ) \sin \left (2 \, x\right ) - {\left (b \cos \left (2 \, x\right ) + b\right )} \sqrt {\frac {{\left (a - b\right )} \cos \left (2 \, x\right ) - a - b}{\cos \left (2 \, x\right ) - 1}}}{2 \, b \sin \left (2 \, x\right )}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \sqrt {a + b \cot ^{2}{\left (x \right )}} \cot ^{2}{\left (x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\mathrm {cot}\left (x\right )}^2\,\sqrt {b\,{\mathrm {cot}\left (x\right )}^2+a} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________